package com.easy.frame.base.service.interceptor;

import com.easy.frame.base.service.web.config.WebConfiguration;
import org.springframework.core.annotation.Order;
import org.springframework.ui.ModelMap;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.WebRequestInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * http拦截器
 * <p>
 * 未启用
 * 如需启用，需在{@link WebConfiguration#addInterceptors(InterceptorRegistry)}中注册
 *
 * @author zzf
 * @date 2020/7/6 18:26
 */
@Order(100)
public class HttpInterceptor implements WebRequestInterceptor {

    @Override
    public void preHandle(WebRequest webRequest) throws Exception {
        System.out.println("********preHandle********");
    }

    @Override
    public void afterCompletion(WebRequest webRequest, Exception e) throws Exception {
        System.out.println("********afterCompletion********");

    }

    @Override
    public void postHandle(WebRequest webRequest, ModelMap modelMap) throws Exception {
        System.out.println("********postHandle********");

    }
}
